<template>
  <el-form ref="formRef" :model="permission" label-width="120px">
    <el-form-item label="权限编号">
      <el-input v-model="permission.id"></el-input>
    </el-form-item>
    <el-form-item label="权限名称">
      <el-input v-model="permission.permissionName"></el-input>
    </el-form-item>
    <el-form-item label="权限url">
      <el-input v-model="permission.url"></el-input>
    </el-form-item>
    <el-form-item label="权限描述">
      <el-input v-model="permission.description" type="textarea"></el-input>
    </el-form-item>
    <el-form-item label="状态">
      <el-switch
          v-model="permission.status"
          active-text="启用"
          inactive-text="停用"
          active-color="#13ce66"
          inactive-color="#ff4949"
          active-value="0"
          inactive-value="2"/>
    </el-form-item>
    <el-form-item>
      <el-button @click="add()">添加</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
import  {addPermission} from "@/api/permssion";
import {ElMessage} from "element-plus";
export default {
  name: "AddPermission",
  data() {
    return {
      permission:{
        id:'',
        permissionName:'',
        url:'',
        description:'',
        status:'0'
      }
    }
  },
  methods:{
    async add() {
      const t = await addPermission()
      if (t.data.code === 200) {
        ElMessage({
          type:'success',
          message:'添加成功'
        })
      }
    }
  }
}
</script>

<style scoped>

</style>